package com.example.musicbox.entity.dto;

import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.Data;
import org.hibernate.validator.constraints.Length;

import javax.validation.constraints.Email;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.Pattern;

/**
 * @author : zhy
 * @since : 2022/8/1
 * 用户注册传输层
 */
@Data
public class RegisterDto {

    @NotBlank(message = "用户名不能为空")
    @Length(max = 20, message = "用户名不能超过20个字符")
    @Pattern(regexp = "^[\\u4E00-\\u9FA5A-Za-z0-9\\*]*$", message = "用户昵称限制：最多20字符，包含文字、字母和数字")
    @JsonProperty(value = "username")
    private String username;


    @NotBlank(message = "联系邮箱不能为空")
    @Email(message = "邮箱格式不对")
    @JsonProperty(value = "uemail")
    private String uemail;


    @NotBlank(message = "密码不能为空")
    @JsonProperty(value = "upassword")
    private String upassword;

    @NotBlank(message = "手机号不能为空")
    @Pattern(regexp = "^[1][3,4,5,6,7,8,9][0-9]{9}$", message = "手机号格式有误")
    @JsonProperty(value = "uphone")
    private String uphone;


    @NotBlank(message = "邮箱验证码不能为空")
    @JsonProperty(value = "code")
    private String code;

    @NotBlank(message = "头像不能为空")
    @JsonProperty(value = "uPhoto")
    private String uphoto;
}
